const fs=require('fs');
const path=require('path');
const argvArr=process.argv;




function delFile(filePath){
    if(fs.existsSync(filePath)){
        if(fs.statSync(filePath).isDirectory()){
            var files=fs.readdirSync(filePath);
            for(var i=0;i<files.length;i++){
                var childPath=path.join(filePath,'/'+files[i]);
                var fileObj=fs.statSync(childPath);
                if(fileObj.isFile()){
                    fs.unlinkSync(childPath);
                }
                else if(fileObj.isDirectory()){
                    delFile(childPath);
                }
            }
            fs.rmdirSync(filePath);
    
        }else{
            fs.unlinkSync(filePath);
            console.log(`${name}文件删除成功`);
        }
    }
}

var arg=argvArr[2];
var filePath=path.join(__dirname,'/'+arg);
delFile(filePath);
